﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;

public partial class Admin_PageUpdate : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            int AID = int.Parse(Request.QueryString["id"].ToString());
            Bind(AID);
        }

    }
    private void Bind(int AID)
    {
        About GetN = new About();
        OleDbDataReader dr = GetN.GetNewsConn(AID);
        if (dr.Read())
        {
            ntitle.Text = dr["Atitle"].ToString();
            ncontent.Value = dr["Acontent"].ToString();
            norderid.Text = dr["Asort"].ToString();
        }
        dr.Close();
        dr.Dispose();

    }
    protected void Button1_Click(object sender, EventArgs e)
    {

        string Atitle = ntitle.Text;
        string conn = ncontent.Value;
        if (CheckKey.Checked)
        {
            conn = SetConnLink.FormatBody(conn);
        }
        int Asort = int.Parse(norderid.Text);
        About Adda = new About();
        Adda.UPPNews(Atitle, conn, "", Asort, int.Parse(Request.QueryString["id"].ToString()));
        Response.Write("<script>alert('" + "添加数据成功！"+"');window.location.href=window.location.href;</script>");
    }

}
